package com.nuanshui.heatedloan.middleware.msgcenter;

import com.nuanshui.heatedloan.middleware.msgcenter.bean.Model;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.reflect.Method;

public class MethodMsgParamsEndPoint implements MsgParamsEndPoint {
	
	private Object bean;//对象
	
	private Method method;//对应的方法
	
	private String beanName;//对应的对象名
	

	public String getBeanName() {
		return beanName;
	}


	public void setBeanName(String beanName) {
		this.beanName = beanName;
	}


	public Object getBean() {
		return bean;
	}


	public void setBean(Object bean) {
		this.bean = bean;
	}


	public Method getMethod() {
		return method;
	}


	public void setMethod(Method method) {
		this.method = method;
	}

	private Logger logger = LoggerFactory.getLogger(MethodMsgParamsEndPoint.class);


	@Override
	public void invokeHandlerMethod(Model model) {
		if(model == null) return ;
		
		try {
			method.invoke(bean,model);
		} catch (Exception e) {
			logger.error("处理参数失败!", e);
		}
	}
	
	

}
